package com.huluobo.a2202mvvm_im_douyindemo.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.a2202mvvm_im_douyindemo.R;
import com.huluobo.a2202mvvm_im_douyindemo.bean.CartBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.utils.ImageLoader;

import java.util.List;

/**
 * Created by LC on 2024/5/16.
 */
public class CartAdapter extends BaseQuickAdapter<CartBeanResult.CartBean, BaseViewHolder> {
    public CartAdapter(@Nullable List<CartBeanResult.CartBean> data) {
        super(R.layout.item_cart, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, CartBeanResult.CartBean cartBean) {
        ImageLoader.getInstance().loadImage(getContext(), cartBean.getGoods_default_icon(),
                baseViewHolder.getView(R.id.item_cart_icon_iv));
        baseViewHolder.setText(R.id.item_cart_desc_tv, cartBean.getGoods_desc());

        baseViewHolder.setText(R.id.item_cart_price_tv, cartBean.getGoods_default_price() + "元");

        baseViewHolder.setText(R.id.item_cart_count_tv, "x" + cartBean.getCount());
    }
}
